package mapEdit;

import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.layout.FillLayout;

import java.util.List;

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FormLayout;
import dataDetail.DataDetail;
import dataNode.DataNodeDesc;
import dataTable.DataTable;
import dataTree.DataTree;
import dataTree.TreeFactory;

import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormAttachment;

public class EditMap extends Composite {
	private DataDetail dataDetail= new DataDetail(this, SWT.NONE);
	
	private DataTable dt=new DataTable(this,SWT.NONE,dataDetail);

	public DataTable getDt() {
		return dt;
	}
	
	private DataTree dtree;
	
	public void addDtNode(DataNodeDesc dnd) {
		dt.addNodeDesc(dnd);
	}

	private List treeDtree;
	public void setTreeDtree(List treeDtree) {
		this.treeDtree = treeDtree;
	}

	/**
	 * Create the composite.
	 * @param parent
	 * @param style
	 */
	public EditMap(Composite parent, int style) {
		super(parent, style);
		setLayout(new FormLayout());
		init();
		

	}
	
	public void init()
	{		
		dtree=new DataTree(this,SWT.NONE,treeDtree,dt);
		FormData dtree_dataDetail = new FormData();
		dtree_dataDetail.bottom = new FormAttachment(100,-10);
		dtree_dataDetail.top = new FormAttachment(0);
		dtree_dataDetail.right = new FormAttachment(20,-5);
		dtree_dataDetail.left= new FormAttachment(0,10);
		dtree.setLayoutData(dtree_dataDetail);		
		
		FormData dt_dataDetail = new FormData();
		dt_dataDetail.bottom = new FormAttachment(100,-10);
		dt_dataDetail.top = new FormAttachment(0);
		dt_dataDetail.right = new FormAttachment(100,-455);
		dt_dataDetail.left= new FormAttachment(20);
		dt.setLayoutData(dt_dataDetail);
		
		FormData fd_dataDetail = new FormData();
		fd_dataDetail.bottom = new FormAttachment(100,-10);
		fd_dataDetail.top = new FormAttachment(0);
		fd_dataDetail.right = new FormAttachment(100, -10);
		//fd_dataDetail.left = new FormAttachment(70, -10);
		dataDetail.setLayoutData(fd_dataDetail);
	}

	public DataTree getDtree() {
		return dtree;
	}

	@Override
	protected void checkSubclass() {
		// Disable the check that prevents subclassing of SWT components
	}
}
